<ion-view ng-controller="ion_book_oneBook" view-title="{{bookInfo.attributes.title}}">
    <ion-nav-buttons side="right">
        <button class="button button-clear button-balanced" ui-sref="book.search-list">寻书</button>
    </ion-nav-buttons>
    <ion-content>
        <!-- 正在加载-->
        <div style="text-align: center;padding-top: 10px" ng-if="isLoading">
            <ion-spinner icon="ripple" class="spinner-balanced"></ion-spinner>
        </div>
        <!-- 图书基本信息-->
        <div class="list">
            <!-- 封面-->
            <ion-item style="text-align: center">
                <img ng-src="{{bookInfo.attributes.bigImage}}" style="height: 180px"
                     ng-click="WeChatJS$.previewOneImage(bookInfo.attributes.bigImage)">
            </ion-item>
            <!-- 简介-->
            <ion-item ng-if="bookInfo.attributes.summary" class="item-button-right">
                <h3>简介</h3>

                <p style="white-space: pre-wrap">{{bookInfo.attributes.summary.substr(0,30)}}...</p>
                <button class="button button-clear button-balanced"
                        ng-click="showSummary()">详情
                </button>
            </ion-item>
            <!-- 作者-->
            <ion-item ng-if="bookInfo.attributes.author.length>0" class="item-button-right">
                {{bookInfo.attributes.author.toString()}} 著
                <button class="button button-small button-clear button-balanced"
                        ng-if="bookInfo.attributes.author_intro"
                        ng-click="showAuthorIntro()">作者简介
                </button>
            </ion-item>
            <!-- 出版信息-->
            <ion-item class="item-button-right">
                <i ng-if="bookInfo.attributes.price"><strong ng-bind="bookInfo.attributes.price"></strong></i>
                <i>&nbsp;</i>
                <i ng-if="bookInfo.attributes.publisher"><em ng-bind="bookInfo.attributes.publisher"></em>/<em
                        ng-bind="bookInfo.attributes.pubdate"></em></i>
                <button class="button button-small button-clear button-balanced" ng-click="showPubInfo()">出版</button>
            </ion-item>

            <!-- 豆瓣书评-->
            <ion-item class="item-button-right" ng-if="bookInfo.attributes.rating">
                <ion-review-star num-stars="{{bookInfo.attributes.rating.average/2}}"
                                 score="{{bookInfo.attributes.rating.average}}"
                                 num-raters="{{bookInfo.attributes.rating.numRaters}}"></ion-review-star>
                <i>&nbsp;</i>
                <button class="button button-small button-clear button-balanced"
                        ng-click="scrollToHash('书评')">书评
                </button>
            </ion-item>
        </div>

        <!-- 电商购买新书-->
        <div class="list" ng-if="businessInfos.length>0">
            <ion-item class="item-divider">网购新书比价</ion-item>
            <ion-item style="white-space:normal">
                <a class="button button-small button-outline button-balanced" style="margin: 5px"
                   ng-repeat="info in businessInfos | orderBy:'price'"
                   ng-href="{{info.url}}">{{info.name}}/{{info.price}}
                </a>
            </ion-item>
        </div>

        <!-- 书漂流-->
        <div class="list" ng-if="UsedBook$.ISBN_circle.nowEqualISBNCircleBooks.length>0">
            <ion-item class="item-divider item-button-right">书漂流-免费送</ion-item>
            <ion-item ng-if="circleBookNumber==0" style="text-align: center">还没有同学分享它</ion-item>
            <ion-item ng-repeat="usedBook in UsedBook$.ISBN_circle.nowEqualISBNCircleBooks"
                      class="item-avatar">
                <img ng-src="{{usedBook.attributes.owner.avatarUrlWithSize(64)}}"
                     ui-sref="common.user-home({ownerId:usedBook.attributes.owner.id})">

                <div ui-sref="book.one-used-book({usedBookAvosObjectId:usedBook.id})">
                    <h3>
                        <span style="white-space: pre-wrap" ng-if="usedBook.attributes.des"
                              ng-bind="usedBook.attributes.des"></span>
                    </h3>

                    <p>于:<strong ng-bind="usedBook.updatedAt | date:'mediumDate'"></strong></p>
                </div>
            </ion-item>
            <ion-item class="littleTailItem"
                      ng-if="UsedBook$.ISBN_circle.nowEqualISBNCircleBooks.length>0"
                      ui-sref="book.used-book-list({cmd:'isbnCircle',isbn13:isbn13})">
                共<strong ng-bind="circleBookNumber"></strong>位同学分享它,查看全部
            </ion-item>

        </div>

        <!-- 二手书-->
        <div class="list" ng-if="UsedBook$.ISBN_sell.nowEqualISBNUsedBooks.length>0">
            <ion-item class="item-divider item-button-right">要卖对应旧书的同学</ion-item>
            <ion-item ng-if="usedBookNumber==0" style="text-align: center">还没有对应的二手书</ion-item>
            <ion-item ng-repeat="usedBook in UsedBook$.ISBN_sell.nowEqualISBNUsedBooks"
                      class="item-avatar">
                <img ng-src="{{usedBook.attributes.owner.avatarUrlWithSize(64)}}"
                     ui-sref="common.user-home({ownerId:usedBook.attributes.owner.id})">

                <div ui-sref="book.one-used-book({usedBookAvosObjectId:usedBook.id})">
                    <h3>
                        <span ng-bind="usedBook.attributes.price"></span>元
                        <span style="white-space: pre-wrap" ng-bind="usedBook.attributes.des"></span>
                    </h3>

                    <p>于:<strong ng-bind="usedBook.updatedAt | date:'mediumDate'"></strong></p>
                </div>
            </ion-item>
            <ion-item class="littleTailItem"
                      ng-if="UsedBook$.ISBN_sell.nowEqualISBNUsedBooks.length>0"
                      ui-sref="book.used-book-list({cmd:'isbnUsed',isbn13:isbn13})">
                共<strong ng-bind="usedBookNumber"></strong>本旧书,查看全部
            </ion-item>

        </div>

        <!-- 求书-->
        <div class="list" ng-if="UsedBook$.ISBN_need.nowEqualISBNNeedBooks.length>0">
            <ion-item class="item-divider item-button-right">正需要它的同学</ion-item>
            <ion-item ng-if="needBookNumber==0" style="text-align: center">还没有同学想要它</ion-item>
            <ion-item ng-if="UsedBook$.ISBN_need.nowEqualISBNNeedBooks.length>0"
                      ng-repeat="usedBook in UsedBook$.ISBN_need.nowEqualISBNNeedBooks"
                      class="item-avatar">
                <img ng-src="{{usedBook.attributes.owner.avatarUrlWithSize(64)}}"
                     ui-sref="common.user-home({ownerId:usedBook.attributes.owner.id})">

                <div ui-sref="book.one-used-book({usedBookAvosObjectId:usedBook.id})">
                    <h3>
                        <span ng-if="usedBook.attributes.price">最高承受<strong
                                ng-bind="usedBook.attributes.price"></strong>元</span>
                        <span style="white-space: pre-wrap" ng-if="usedBook.attributes.des"
                              ng-bind="usedBook.attributes.des"></span>
                    </h3>

                    <p>于:<strong ng-bind="usedBook.updatedAt | date:'mediumDate'"></strong></p>
                </div>
            </ion-item>
            <ion-item class="littleTailItem"
                      ng-if="UsedBook$.ISBN_need.nowEqualISBNNeedBooks.length>0"
                      ui-sref="book.used-book-list({cmd:'isbnNeed',isbn13:isbn13})">
                共<strong ng-bind="needBookNumber"></strong>位同学想要它,查看全部
            </ion-item>

        </div>

        <div class="list">
            <ion-item class="item-divider item-button-right">上传</ion-item>
            <div class="button-bar">
                <a class="button button-balanced"
                   ui-sref="person.upload-one-used-book({isbn13:bookInfo.attributes.isbn13,role:'circle'})">图书漂流</a>
                <a class="button button-balanced"
                   ui-sref="person.upload-one-used-book({isbn13:bookInfo.attributes.isbn13,role:'sell'})">转让旧书</a>
                <a class="button button-balanced"
                   ui-sref="person.upload-one-used-book({isbn13:bookInfo.attributes.isbn13,role:'need'})">求书公告</a>
            </div>
        </div>

        <!-- 书评-->
        <div class="list" id="书评" ng-if="DoubanBook$.BookReview.reviewList.length>0">
            <ion-item class="item-divider item-button-right">书评</ion-item>
            <ion-item class="item-avatar" ng-repeat="review in DoubanBook$.BookReview.reviewList">
                <img ng-src="{{review.avatarUrl}}">

                <h3 ng-bind="review.title"></h3>

                <p style="white-space: pre-wrap" ng-bind="review.context"></p>
            </ion-item>
            <ion-infinite-scroll ng-if="DoubanBook$.BookReview.hasMore()"
                                 on-infinite="DoubanBook$.BookReview.loadMore()"
                                 distance="1%">
            </ion-infinite-scroll>
        </div>

    </ion-content>
</ion-view>

